I had similar issues with a <br>
tag being added to the first line in a form I was trying dynamically generate using PHP.
The solution I found was to edit the default-filters.php file in the wp-includes folder.
There are several lines of code that look like this:
add_filter( 'the_content', 'wpautop'
My issue was resolved when I commented out the line under
// Display filters
...
//add_filter( 'the_content', 'wpautop' );
Hope this helps.