From my experiences, when I catch a pokemon, my level affect the CP of that pokemon, ie, higher level I am, higher CP pokemon I will catch. If you evolve magikarp with CP 145 now, it is OK. The matter is the move after you evolved to a Gyarados, because there is a higher chance for a Gyarados with bite + twister. I know some people get bite + HP/DP when he/she got a 3rd or 4th Gyarados. I got bit + DP with my 3rd Gyarados.
For your last question, trainer level doesn't play role in determine the pokemon cp after evolution. When I was level 18, I caught a Evee wih CP around 500, it evolved to Vaporeon with CP 1700 to 1800 (I don't remember the exact number). Now, I am level 29, I caught a Evee with CP around 600 an hour ago, it also evolved to a Vaporeon that with CP around 1900.